package com.example.train_operate.config;
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//


import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import java.util.ArrayList;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfig {
    public SwaggerConfig() {
    }

    @Bean
    public Docket createRestApi() {
        List<Parameter> parameterList = new ArrayList();
        ParameterBuilder parameterBuilder = new ParameterBuilder();
        parameterBuilder.name("Authorization").description("请求头token凭证").modelRef(new ModelRef("string")).parameterType("header").required(false);
        parameterList.add(parameterBuilder.build());
        return (new Docket(DocumentationType.SWAGGER_2)).groupName("v1").apiInfo(this.apiInfo()).select().apis(RequestHandlerSelectors.basePackage("com.example.train_operate.controller")).paths(PathSelectors.any()).build().globalOperationParameters(parameterList);
    }

    private ApiInfo apiInfo() {
        return (new ApiInfoBuilder()).title("列控巡检接口文档").description("接口文档").contact(new Contact("", "http://localhost:8706/doc.html", "2160923185@qq.com")).version("1.0").build();
    }
}